Public: Concord Software Projects : Design for passing session info to SAIL
This page last changed on Aug 31, 2009 by aunger.
Per a discussion with Stephen in IRC (http://rails.dev.concord.org/irclog/otrunk/2009-08-28.html#T18-35-44), here's a description of a way to pass session information into a SAIL session and have the info automatically included in HTTP requests made from the Java environment, in effect making the Java code aware of an existing http session. The CookieService
ConfiguringBasically the idea is to create a Cookie SAIL Service which is initialized via the config file which defines the services for a SAIL session. The SDS (or equivalent web app) would embed whatever cookie information it wanted into the config. For example: <object class="net.sf.sail.emf.launch.HttpCookieServiceImpl"> <void property="cookieProperties"> <object class="java.util.Properties"> <void method="setProperty"> <string>concord.org</string> <string>some_session_key; foo=bar</string> </void> <void method="setProperty"> <string>*.some.wildcard.domain.com</string> <string>some_other_session_key</string> </void> <void method="setProperty"> <string>*</string> <string>some_global_cookie_property</string> </void> </object> </void> </object> What the service doesThe cookie service would take it's set of passed in cookie definitions, and then set up a new java.net.CookieHandler (or it itself could be one), which it then registers as the global CookieHandler via CookieHandler.setDefault(CookieHandler). This CookieHandler would then embed cookies with the appropriate session information on appropriate requests, thus allowing the Java code to continue the existing http session started in the browser. References |
Document generated by Confluence on Jan 27, 2014 16:52 |